package com.calenda.setevent.activity;

import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageView;

import com.calenda.setevent.BaseActivity;
import com.calenda.setevent.R;
import com.calenda.setevent.fragment.CreateEventFragment;
import com.calenda.setevent.fragment.CreateGroupFragment;
import com.calenda.setevent.fragment.GridGroupFragment;
import com.calenda.setevent.fragment.SearchGroupFragment;

public class MainActivity extends BaseActivity implements OnClickListener {

	private ImageView ivAddGroup;
	private ImageView ivQrCode;
	private ImageView ivSearchGroup;
	private ImageView ivNote;
	private ImageView ivLstGroup;
	private ImageView ivLstEvent;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.home_activity);

		setFragment(new GridGroupFragment(), R.id.frame);
		
		initUI();
	}
	
	private void initUI(){
		ivAddGroup = (ImageView)findViewById(R.id.ivAddGroup);
		ivQrCode = (ImageView)findViewById(R.id.ivQrCode);
		ivSearchGroup = (ImageView)findViewById(R.id.ivSearchGroup);
		ivNote = (ImageView)findViewById(R.id.ivNote);
		ivLstGroup = (ImageView)findViewById(R.id.ivLstGroup);
		ivLstEvent = (ImageView)findViewById(R.id.ivLstEvent);
		
		ivAddGroup.setOnClickListener(this);
		ivLstGroup.setOnClickListener(this);
		ivSearchGroup.setOnClickListener(this);
	}
	
	@Override
	public void onBackPressed() {
		// TODO Auto-generated method stub
		super.onBackPressed();
	}

	@Override
	public void onClick(View arg0) {
		switch (arg0.getId()) {
		case R.id.ivAddGroup:
			setFragment(new CreateGroupFragment(), R.id.frame);
			break;
		case R.id.ivLstGroup:
			setFragment(new GridGroupFragment(), R.id.frame);
			break;
		case R.id.ivSearchGroup:
			setFragment(new SearchGroupFragment(), R.id.frame);
			break;

		default:
			break;
		}
	}

}
